
#include "LINK-Request.h"
#include "DLT698-Frame.h"


LinkRequest LinkRequest::c_link_request;


LinkRequest::LinkRequest(/* args */)
{
}

LinkRequest::~LinkRequest()
{
}

LinkRequest& LinkRequest::getInstance(){
    return c_link_request;
}

int LinkRequest::packet(uint8_t* data, int& len, LINK_REQUEST_TYPE type, uint16_t heartbeat_interval, int start){
    if((NULL== data) || (start > len) || (1 > len)){
        return -1;
    }
    int offset = 0;
    data[start] = DLT698Frame::getInstance().get_piid_acd();
    offset += 1;
    data[start+offset] = type;
    offset += 1;
    *((uint16_t *)(data+start+offset)) = heartbeat_interval;
    offset += sizeof(uint16_t);
    return offset;
}

int LinkRequest::unpack(uint8_t* data, int& len, int start){

}